package pers.jphoebe.quartz.job;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import pers.jphoebe.quartz.exception.CustomException;
import pers.jphoebe.quartz.service.GoldDataFromJuheService;
import pers.jphoebe.quartz.utils.Logger;


/**
 * GsiPriceJob class
 *
 * @author 蒋时华
 * @date 2017/11/6
 */
public class GsiPriceJob implements BaseJob {

    private Logger logger = Logger.getLogger(this.getClass());

    @Autowired
    private GoldDataFromJuheService goldDataFromJuheService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info(null,"触发定时更新金银价数据");
        try{
            goldDataFromJuheService.saveJuheGoldDataByVariety();
        }catch (CustomException e){
            logger.error("定时更新金银价数据错误");
            throw new JobExecutionException();
        }
    }
}
